package com.dxy.common.user;

import com.dxy.common.pojo.Group;
import com.dxy.common.pojo.Role;
import com.dxy.common.pojo.User;
import lombok.Data;

import java.util.List;

/**
 * 认证用户主体
 */
@Data // json序列化、反序列化必须要有setter、getter方法
public class AuthUserSubject {

    /**
     * 当前用户
     */
    private User user;

    /**
     * 分组
     */
    private List<Group> groups;

    /**
     * 角色
     */
    private List<Role> roles;

    public AuthUserSubject() {
    }

    public AuthUserSubject(User user, List<Group> groups, List<Role> roles) {
        this.user = user;
        this.groups = groups;
        this.roles = roles;
    }

    public User user() {
        return this.user;
    }

    public List<Group> groups() {
        return this.groups;
    }

    public List<Role> roles() {
        return this.roles;
    }
}
